package com.wwz.frame.controller;

import com.wwz.frame.event.SaveEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;
/**  
* @Description 发布事件
* @Author wwz
* @Date 2019/08/26
* @Param   
* @Return   
*/ 
@RestController
public class EventController {

    @Autowired
    private ApplicationContext applicationContext;

    @RequestMapping("/event")
    public String application() {
        Map map = new HashMap(5);
        map.put("name", "wwz");
        SaveEvent event = new SaveEvent(this, map);
        applicationContext.publishEvent(event);
        return "success";
    }
}
